package com.hudson.plugin.result.collector.server.datastore.dao;

import com.hudson.plugin.result.collector.server.datastore.dao.exceptions.NonexistentEntityException;
import com.hudson.plugin.result.collector.server.datastore.dao.exceptions.PreexistingEntityException;
import com.hudson.plugin.result.collector.server.datastore.internal.entity.HudsonsEntity;

import javax.persistence.EntityManager;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Richard
 * Date: 5/8/11
 * Time: 9:42 PM
 * To change this template use File | Settings | File Templates.
 */
public interface HudsonsEntityJpaController {
    EntityManager getEntityManager();

    void create(HudsonsEntity hudsonsEntity) throws PreexistingEntityException, Exception;

    void edit(HudsonsEntity hudsonsEntity) throws NonexistentEntityException, Exception;

    void destroy(int id) throws NonexistentEntityException;

    HudsonsEntity findHudsonsEntity(int id);

    List<Integer> findHudsonsEntity(String url);

    List<HudsonsEntity> findHudsonsEntityEntities();

    List<HudsonsEntity> findHudsonsEntityEntitiesWithInterval(boolean isAverage, int resultsInterval, int firstResult);

    List<HudsonsEntity> findHudsonsEntityEntities(int maxResults, int firstResult);

    int getHudsonsEntityCount();
}
